/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ecom.beans.session;

import ecom.beans.session.CartLocal;
import java.util.ArrayList;
//import javax.ejb.SessionSynchronization;
import javax.ejb.Stateful;
import java.util.List;


@Stateful
public class CartBean implements CartLocal {
    
    private List<Long> caddie;
    private Long id;

    public CartBean (){
        this.caddie = new ArrayList<Long>();
    }
    
 
    public void addProduit(long id) {
       
        caddie.add(id);
    }

    @Override
    public boolean deleteProduit(long idProduit) {
       
        boolean ok = caddie.remove(idProduit);
        if (ok==true){
            return true;
        }
        else{
            return false;
        }
    }

    @Override
    public List<Long> getProduits(){
        return caddie;
    }

    @Override
    public void vider(){
        caddie.clear();
    }


    }


